//查找数组指定元素（顺序查找）
import java.util.Scanner;
public class Test1 {
    public static void main(String[] args) {
        int[] arr = {1,2,3,4,5,6,7,8,9,10};
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入需要查找的数据：");
        int find = sc.nextInt();
        int ret = find(arr, find);
        if(ret == -1)
            System.out.println("不存在");else{
            System.out.println("找到了，下标为" + ret);
        }
    }
    public static int find(int[] arr, int pose){
        for(int i = 0; i < arr.length; i++){
            if(arr[i] == pose)
                return i;
        }
        return -1;
    }
}
